$(function () {

    $(".right-list li").attr("class","");

    $(".right-list li:last-child").attr("class","right-list-active");

    $("#submit").on("click",function (e) {
        e.preventDefault();

        if($("[name=linkPerson]").val()=='' || $("[name=linkPerson]").val().length==0){
            alert("请输入联系人");
            return;
        }
        if($("[name=linkWay]").val()=='' || $("[name=linkWay]").val().length==0){
            alert("请输入联系方式");
            return;
        }
        if($("[name=content]").val()=='' || $("[name=content]").val().length==0){
            alert("请输入留言内容");
            return;
        }
        if($("[name=code]").val()=='' || $("[name=code]").val().length==0){
            alert("请输入验证码");
            return;
        }

        var leaves = {
            attn:$("[name=linkPerson]").val(),
            way:$("[name=linkWay]").val(),
            content:$("[name=content]").val(),
            code:$("[name=code]").val()
        }

        $.ajax({
            url:basePath+"asme/submit",
            type:"POST",
            contentType:"application/json;charset=UTF-8",
            async:false,
            dataType:'JSON',
            data:JSON.stringify(leaves),
                success:function (data) {
                    if(data.success == true){
                        alert(data.code);
                        window.location.reload();
                    }else{
                        alert(data.code);
                    }
                }

        })


    })









})